Javascript hoisting with variable and function